#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
	int res=0,f=1;char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9'){res=(res<<1)+(res<<3)+(c^48);c=getchar();}
	return res*f;
}
void write(int x)
{
	if(x<0)x=-x,putchar('-');
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
#define db double
int n;
int op[500005],k[500005];
int id[500005];
int T[500005],F[500005],B[500005];
int cnt,tot;
db bkt[500005];
struct Nene
{
	int t[500005];
	inline int lowbit(int x){return x&-x;}
	inline void add(int x,int v){for(;x<=n;x+=lowbit(x))t[x]+=v;}
	inline int query(int x){int res=0;for(;x;x-=lowbit(x))res+=t[x];return res;}
}bit[2];
inline db calc(db p)
{
	int pos=upper_bound(bkt+1,bkt+tot+1,p)-bkt-1;
	return -bit[0].query(pos)+bit[1].query(pos)*p+
	bit[0].query(n)-bit[0].query(pos)-(bit[1].query(n)-bit[1].query(pos))*p;
}
inline db cnm(db p)
{
	db res=0;
	for(int i=1;i<=cnt;i++)
		if(!id[i]) res+=abs(T[i]*(F[i]-p)+B[i]);
	return res;
}
signed main()
{
	freopen("love.in","r",stdin);
	freopen("love.out","w",stdout);
	n=read();
	if(n<=5000)
	{
		while(n--)
		{
			int op=read(),k;
			if(op==1) F[++cnt]=read(),T[cnt]=read(),B[cnt]=read();
			else k=read(),id[k]=1;
			db l=-1e4,r=1e4;
			db res;
			while(r-l>1e-10)
			{
				db mid=(l+r)/2;
				if(cnm(mid)>cnm(mid+1e-10)) res=mid,l=mid;
				else r=mid;
			}
			printf("%.10lf\n",cnm(res));
		}
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		op[i]=read();
		if(op[i]==1) ++cnt,F[cnt]=read(),T[cnt]=read(),B[cnt]=read(),id[i]=cnt;
		else k[i]=read();
		if(T[cnt]) bkt[cnt]=1.0*(T[cnt]*F[cnt]+B[cnt])/(1.0*T[cnt]);
	}
	bkt[++cnt]=1e9;
	sort(bkt+1,bkt+cnt+1);
	tot=unique(bkt+1,bkt+cnt+1)-bkt-1;
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		if(op[i]==1)
		{
			if(!T[id[i]])
			{
				sum+=abs(B[id[i]]);
				continue;
			}
			db tmp=1.0*(T[id[i]]*F[id[i]]+B[id[i]])/(1.0*T[id[i]]);
			int p=lower_bound(bkt+1,bkt+tot+1,tmp)-bkt;
			bit[0].add(p,T[id[i]]*F[id[i]]+B[id[i]]);
			bit[1].add(p,T[id[i]]);
		}
		else
		{
			if(!T[k[i]]) 
			{
				sum-=abs(B[k[i]]);
				continue;
			}
			db tmp=1.0*(T[k[i]]*F[k[i]]+B[k[i]])/(1.0*T[k[i]]);
			int p=lower_bound(bkt+1,bkt+tot+1,tmp)-bkt;
			bit[0].add(p,-T[k[i]]*F[k[i]]-B[k[i]]);
			bit[1].add(p,-T[k[i]]);
		}
		db l=-1e4,r=1e4;
		while(r-l>1e-9)
		{
			db lmid=l+(r-l)/3,rmid=r-(r-l)/3;
			if(calc(lmid)-calc(rmid)<0) r=rmid;
			else l=lmid;
		}
		printf("%.10lf\n",calc(l)+sum);
	}
	return 0;
}	

